package com.ddrh.sencha.sencha.backend;

import java.util.List;

import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.log4j.Logger;

import com.ddrh.sencha.sencha.backend.model.Contact;
import com.ddrh.sencha.sencha.backend.utils.ContactUtils;
import com.google.gson.Gson;

public class SenchaServlets extends HttpServlet {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private Logger log = Logger.getLogger("CONSOLE");

	public void doGet(HttpServletRequest request, HttpServletResponse response) {
		doPost(request, response);
	}

	public void doPost(HttpServletRequest request, HttpServletResponse response) {
		List<Contact> listContact = ContactUtils.generateContacts();

		Gson gson = new Gson();
		String json = gson.toJson(listContact);
		log.info("[SENCHA] Json: " + json);

	}

}
